import request from '@/utils/request';

// 获取学生用户信息
export const selectByToken = () => {
    return request({
        url: "/user/selectByToken",
        method: "GET",
    });
};

//完善学生用户信息
export const updateUserInfo = data => {
    const {
        email,
        name,
        avatar,
        gender,
        phone,
        age,
        studyStatus,
        education,
        school,
        major,
        jobRegion,
        desiredPosition,
        minSalary,
        maxSalary,
    } = data;
    return request({
        url: "/user/update",
        method: "PUT",
        data: {
            email,
            name,
            avatar,
            gender,
            phone,
            age,
            studyStatus,
            education,
            school,
            major,
            jobRegion,
            desiredPosition,
            minSalary,
            maxSalary,
        },
    });
};

// 获取企业用户信息
export const selectEmployByToken = () => {
    return request({
        url: "/employ/selectByToken",
        method: "GET",
    });
};

//完善企业用户信息
export const updateEmployInfo = data => {
    const {
        email,
        avatar,
        phone,
        enterpriseName,
        companySize,
        companyRegion,
        companyIndustry,
        companyProfile,
        financingStage
    } = data;
    return request({
        url: "/employ/update",
        method: "PUT",
        data: {
            email,
            avatar,
            phone,
            enterpriseName,
            companySize,
            companyRegion,
            companyIndustry,
            companyProfile,
            financingStage
        },
    });
};


//获取学校列表
export const getSchools = (schoolName) => {
    return request({
        url: `/eduExps/schools?schoolName=${schoolName}`,
        method: "GET",
    });
}


//获取学校列表
export const getmajors = (majorName) => {
    return request({
        url: `/eduExps/majors?majorName=${majorName}`,
        method: "GET",
    });
}

//获取地区列表
export const getProvinces = () => {
    return request({
        url: `/eduExps/provinces`,
        method: "GET",
    });
}

//获取职位列表
export const getJobNames = () => {
    return request({
        url: `/eduExps/jobNames`,
        method: "GET",
    });
}

//获取学生所有投递过的简历
export const getresumeSubmit = (pageNum, pageSize) => {
    return request({
        url: `/resumeSubmit/selectJob?pageNum=${pageNum}&pageSize=${pageSize}`,
        method: "GET",
    });
}

//用户画像
export const getGeneratePortrait = () => {
    return request({
        url: `/user/generatePortrait`,
        method: "GET",
    });
}

//用户画像
export const getCount = () => {
    return request({
        url: `/employ/visual/count`,
        method: "GET",
    });
}